Another way is to replace the putPicProc, as is commonly done when spooling a picture to disk, and instead spool it to temporary memory.
You create a handle in temporary memory the size of a picture and fill in its size and picFrame fields so that it looks like a normal picture handle. In your putPicProc you copy the data in, continually resizing the handle if necessary to fit the data. After you call ClosePicture, remove your putPicProc; then you can use the temporary handle just like a normal picture.
The advantage of this method over the first one is that you can make the
picture as large as temporary memory will let you, and you end up using just
enough memory. The first technique, while technically easier to implement,
limits you to the size of the heap you initially create, and you also may use a
lot more temporary memory than you need. If you're able to come up with a good
guess of how large your pictures are going to be, use the first technique; if
not, use the second one.
See Inside Macintosh: Memory for more information about creating heap zones.
If you're not familiar with picture spooling, see Inside Macintosh Volume V, page 89, which
has code for spooling a picture to disk as it's created. This is the same
technique as documented there, only it spools the picture to temporary memory
instead.